package com.sevenStar.healthManagement.service.impl;

import com.sevenStar.healthManagement.entity.Admin;
import com.sevenStar.healthManagement.entity.User;
import com.sevenStar.healthManagement.mapper.AdminMapper;
import com.sevenStar.healthManagement.mapper.UserMapper;
import com.sevenStar.healthManagement.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdminServiceImpl implements AdminService {
	@Autowired
	private AdminMapper adminMapper;
	@Autowired
	private UserMapper userMapper;

	public Admin login(Admin admin) {
		return adminMapper.selectOne(admin);
	}


	public List<User> getAllUser() {
		return userMapper.selectAll();
	}

	@Override
	public User queryById(String id) {
		return adminMapper.selectById(id);
	}

	@Override
	public boolean updateUser(User user) {
		return adminMapper.updateUserById(user)>0;
	}
}
